package com.android.util;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;

public class ToastUtils {

    private static Toast mToast;
    private static Handler handler;

    public static void init(Context context) {
        mToast = Toast.makeText(context, "", Toast.LENGTH_LONG);
        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                mToast.setText(msg.obj + "");
                mToast.show();
            }
        };
    }

    public static void show(Object msg) {
        Message message = handler.obtainMessage();
        message.obj = msg;
        handler.sendMessage(message);
    }


}
